package com.cloudeye.bus.manage.web;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class NacosTest {

    @Autowired
    private LoadBalancerClient loadBalancerClient;


    @RequestMapping("/test")
    public String test(){
        ServiceInstance instance = loadBalancerClient.choose("api-gateway");
        return JSON.toJSONString(instance);
    }
}
